package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;
import java.util.HashMap;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetSellerOrderListBean;
import com.ymatou.query.trading.api.service.GetSellerOrderListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.common.enums.OrderDateEnum;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/**
 * 查询卖家订单信息 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetSellerOrderList {

	private static GetSellerOrderListBean getsellerorderlistbean;
	private static GetSellerOrderListCall getsellerorderlistcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询卖家订单信息");
	}

	@Before
	public void caseUp() {

		getsellerorderlistbean = new GetSellerOrderListBean();
		getsellerorderlistcall = new GetSellerOrderListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getsellerorderlistcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetSellerOrderList_001() {
		Logger.start(true,"查询卖家订单信息成功");
		try {
			//int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int SellerId = 3383;
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-10);
			getsellerorderlistbean.setBeginTime(BeginTime);
			getsellerorderlistbean.setCurrentPageNum(1);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(1);
			getsellerorderlistbean.setEndTime(EndTime);
			getsellerorderlistbean.setIsPaidInFull(null);// 是否全额付款
			getsellerorderlistbean.setIsShangouOrder(false);// 是否闪购订单
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			getsellerorderlistbean.setLogisticsTypeList(LogisticsTypeList);
			getsellerorderlistbean.setOrderDateEnum(OrderDateEnum.PayDate);// 订单日期
			// 订单状态列表
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(17);
			getsellerorderlistbean.setOrderStatusList(OrderStatusList);
			// 订单类型列表
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			getsellerorderlistbean.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			getsellerorderlistbean.setOverTimeLimitDic(map);
			getsellerorderlistbean.setPageSize(10);// 页面数据条数
			getsellerorderlistbean.setSearchKeyWord("测试");// 查询关键词
			getsellerorderlistbean.setSellerId(SellerId);
			// 发送请求
			getsellerorderlistcall.setData(getsellerorderlistbean);
			getsellerorderlistcall.callService();
			Logger.comment("getsellerorderlistcall send:" + getsellerorderlistcall.getEntityString());
			Logger.comment("getsellerorderlistcall response:" + getsellerorderlistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getsellerorderlistcall.getMsg(), "验证Msg");
			Logger.verifyEquals(true, getsellerorderlistcall.getOrderInfoList().size() > 0, "验证结果不为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}